package com.pig4cloud.pig.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.admin.entity.Field;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.repository.query.Param;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author mobai
 */
@Mapper
public interface CommonMapper extends BaseMapper<Map<String, Object>> {
	void createBaseEntity(String tableName);

	void addTableField(String tableName, Field field);

	void removeTableField(String tableName, String fieldName);

	Page<Map<String, Object>> queryPage(Page page, @Param("tableName") String tableName, @Param("fieldNameList") Collection<String> fieldNameList, @Param("condition") String condition, @Param("params") Map<String, Object> params);

	Boolean insertTableData(String insertSql, @Param("params") Map<String, Object> params);

	Map<String, Object> getDetails(String tableName, String id, List<String> fieldNameList);

	Boolean updateEntityById(String updateSql, @Param("params") Map<String, Object> params);


	Boolean setProcessInstanceId(String tableName, Object id, String processInstanceId);

	Boolean removeDataById(String tableName, Long[] ids);

	List<String> queryProcessInstanceIdByIdList(String tableName, Long[] ids);
}
